package com.liugui;

/**
 * @ClassName: ThreadDemo
 * @Author: liugui
 * @Date: 2021-05-19 11:32
 **/
public class ThreadDemo {
    public static void main(String[] args) {
        MyThread2 mt2 = new MyThread2("测试线程A");
        MyThread2 mt3 = new MyThread2("测试线程B");

        mt2.start();
        mt3.start();
    }
}

class MyThread2 extends Thread{
    private String strName;

    public MyThread2(String strName) {
        this.strName = strName;
    }

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(this.strName + "执行第 " + i + " 次");
        }
    }
}
